package xzs.wx.wxappFace;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;

import com.tencentcloudapi.faceid.v20180301.FaceidClient;

import com.tencentcloudapi.faceid.v20180301.models.DetectAuthRequest;
import com.tencentcloudapi.faceid.v20180301.models.DetectAuthResponse;

public class DetectAuth {
    public static void main(String[] args) {
        try {

            Credential cred = new Credential("AKIDSffNBnxDWZOwFI4dZEdmtGMAiwtZF85i", "XoGUP3UouqWv2tvkSwGI8hzyhJeqlQov");

            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("faceid.tencentcloudapi.com");

            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);

            FaceidClient client = new FaceidClient(cred, "ap-beijing", clientProfile);

            String params = "{\"IdCard\":\"130223199212044319\",\"Name\":\"徐志胜\",\"RuleId\":\"1\"}";
            DetectAuthRequest req = DetectAuthRequest.fromJsonString(params, DetectAuthRequest.class);

            DetectAuthResponse resp = client.DetectAuth(req);

            System.out.println(DetectAuthResponse.toJsonString(resp));
        } catch (TencentCloudSDKException e) {
            System.out.println(e.toString());
        }

    }

}